package inventory.stockManagement.view;

import java.awt.Color;

import javax.swing.AbstractListModel;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.SpringLayout;
import javax.swing.border.LineBorder;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.DefaultTableModel;
import javax.swing.JButton;

import common.view.IssueSlipView;

import java.awt.Font;

public class OpenIssueSlipView extends JPanel 
{
	private JList list;
	private JTable table;
	private IssueSlipView issueSlipView;

	public OpenIssueSlipView()
	{
		SpringLayout sl_this = new SpringLayout();
		this.setLayout(sl_this);
		
		JLabel lblOpenIssueSlips = new JLabel("Open Issue Slips :");
		lblOpenIssueSlips.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		sl_this.putConstraint(SpringLayout.NORTH, lblOpenIssueSlips, 10, SpringLayout.NORTH, this);
		sl_this.putConstraint(SpringLayout.WEST, lblOpenIssueSlips, 10, SpringLayout.WEST, this);
		this.add(lblOpenIssueSlips);
		
		issueSlipView = new IssueSlipView();
		sl_this.putConstraint(SpringLayout.NORTH, issueSlipView, 33, SpringLayout.NORTH, this);
		sl_this.putConstraint(SpringLayout.WEST, issueSlipView, 200, SpringLayout.WEST, this);
		sl_this.putConstraint(SpringLayout.SOUTH, issueSlipView, -45, SpringLayout.SOUTH, this);
		sl_this.putConstraint(SpringLayout.EAST, issueSlipView, -10, SpringLayout.EAST, this);
		this.add(issueSlipView);
		
		
		
		list = new JList();
		sl_this.putConstraint(SpringLayout.NORTH, list, 6, SpringLayout.SOUTH, lblOpenIssueSlips);
		sl_this.putConstraint(SpringLayout.WEST, list, 10, SpringLayout.WEST,this);
		sl_this.putConstraint(SpringLayout.SOUTH, list, -45, SpringLayout.SOUTH, this);
		sl_this.putConstraint(SpringLayout.EAST, list, -10, SpringLayout.WEST,issueSlipView);
		
		list.setBorder(new LineBorder(new Color(0, 0, 0)));
		sl_this.putConstraint(SpringLayout.WEST, list, 10, SpringLayout.WEST, this);
		sl_this.putConstraint(SpringLayout.EAST, list, 100, SpringLayout.WEST, this);
		list.setModel(new AbstractListModel() {
			String[] values = new String[] {};
			public int getSize() {
				return values.length;
			}
			public Object getElementAt(int index) {
				return values[index];
			}
		});
		this.add(list);
		list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 

	}

	public IssueSlipView getIssueSlipView() {
		return issueSlipView;
	}

	public void setIssueSlipView(IssueSlipView issueSlipView) {
		this.issueSlipView = issueSlipView;
	}

	public void setList(JList list) {
		this.list = list;
	}

	public JList getList() {
		return list;
	}

	public void setList1(JList list1) {
		this.list = list1;
	}
	
	
	
	public JTable getTable() {
		return table;
	}

	public void setTable(JTable table) {
		this.table = table;
	}

	

	public void addlistlistener(ListSelectionListener ls)
	{
		list.addListSelectionListener(ls);
	}

}
